===============================================
FIX HTTP 500 ERROR - AGENT PANEL
===============================================

PENYEBAB ERROR 500:
===================
- File vouchers.php, topup.php, dll tidak punya HTML wrapper lengkap
- Hanya ada content PHP tanpa <!DOCTYPE>, <html>, <head>, <body>
- Include header/footer menyebabkan conflict

SOLUSI CEPAT:
=============

OPSI 1: GUNAKAN DASHBOARD SAJA (TERMUDAH)
------------------------------------------
Untuk sementara, gunakan hanya dashboard.php dan generate.php yang sudah berfungsi.

File yang SUDAH BERFUNGSI:
- dashboard.php ✅
- generate.php ✅
- logout.php ✅

File yang BELUM SIAP (skip dulu):
- vouchers.php ❌
- topup.php ❌
- transactions.php ❌
- prices.php ❌
- profile.php ❌
- help.php ❌

OPSI 2: HAPUS FILE YANG ERROR
------------------------------
Hapus atau rename file-file yang menyebabkan 500:

1. Rename file bermasalah:
   vouchers.php → vouchers.php.bak
   topup.php → topup.php.bak
   transactions.php → transactions.php.bak
   prices.php → prices.php.bak
   profile.php → profile.php.bak
   help.php → help.php.bak

2. Update sidebar.php, hapus link ke file tersebut

3. Test dashboard.php - seharusnya berfungsi

OPSI 3: FIX MANUAL (ADVANCED)
------------------------------
Setiap file harus punya struktur lengkap seperti dashboard.php:

```php
<?php
session_start();
if (!isset($_SESSION['agent_id'])) {
    header("Location: index.php");
    exit;
}
include('../include/db_config.php');
include('../lib/Agent.class.php');
$agent = new Agent();
$agentData = $agent->getAgentById($_SESSION['agent_id']);
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Halaman</title>
    <link rel="stylesheet" href="css/agent-style.css">
</head>
<body>
    <?php include('includes/sidebar.php'); ?>
    <div class="main-content">
        <!-- CONTENT DI SINI -->
    </div>
    <script src="js/agent-script.js"></script>
</body>
</html>
```

===============================================

SOLUSI YANG SAYA REKOMENDASIKAN:
=================================

LANGKAH 1: ROLLBACK KE VERSI SIMPLE
------------------------------------
1. Hapus file-file baru yang error:
   - vouchers.php
   - topup.php
   - transactions.php
   - prices.php
   - profile.php
   - help.php
   - main.php
   - _header.php
   - _footer.php
   - vouchers_standalone.php

2. Biarkan hanya file yang sudah berfungsi:
   - dashboard.php ✅
   - generate.php ✅
   - index.php ✅
   - logout.php ✅

LANGKAH 2: UPDATE SIDEBAR
--------------------------
Edit includes/sidebar.php, hapus link yang error:

```php
<nav class="sidebar-menu">
    <a href="dashboard.php" class="menu-item"><i class="fa fa-dashboard"></i><span>Dashboard</span></a>
    <a href="generate.php" class="menu-item"><i class="fa fa-ticket"></i><span>Generate Voucher</span></a>
    <!-- HAPUS LINK LAINNYA DULU -->
    <a href="logout.php" class="menu-item"><i class="fa fa-sign-out"></i><span>Logout</span></a>
</nav>
```

LANGKAH 3: TEST
---------------
1. Clear browser cache
2. Akses dashboard.php
3. Seharusnya tidak error lagi

LANGKAH 4: TAMBAH FITUR BERTAHAP
---------------------------------
Nanti kita bisa tambah fitur satu per satu dengan benar.

===============================================

CARA CEK ERROR 500:
===================

1. CEK PHP ERROR LOG:
   - cPanel → Error Log
   - Atau file: error_log di folder agent/

2. ENABLE ERROR DISPLAY:
   Tambahkan di awal file PHP:
   ```php
   error_reporting(E_ALL);
   ini_set('display_errors', 1);
   ```

3. CEK BROWSER CONSOLE:
   - Tekan F12
   - Tab Console
   - Lihat error message

===============================================

KESIMPULAN:
===========

Untuk sekarang:
1. ✅ Gunakan dashboard.php (sudah berfungsi)
2. ✅ Gunakan generate.php (sudah berfungsi)
3. ❌ Skip fitur lain dulu (vouchers, topup, dll)

Nanti kita develop fitur tambahan dengan benar,
satu per satu, dengan testing yang proper.

===============================================

YANG PENTING SEKARANG:
======================

✅ Admin panel berfungsi (tambah agent, set harga, topup)
✅ Agent bisa login
✅ Agent bisa lihat dashboard
✅ Agent bisa generate voucher

Fitur lainnya bisa ditambahkan nanti setelah
sistem utama stabil.

===============================================
